package com.after.saas.file.handler;

import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Description
 * @Classname MedalFactory
 * @Author hjchen
 * @Version V1.0.0
 * @Since 1.0
 * @Date 2023/4/7 15:23
 */

@Component
public class MedalLevelFactory {

    public Map<String, MedalLevel> levelMap = new HashMap<>();

    public MedalLevelFactory(List<MedalLevel> levels) {
        for (MedalLevel level : levels) {
            levelMap.put(level.getMedalEnum().name(), level);
        }
    }

    public MedalLevel generateLevel(String name) {
        return levelMap.get(name);
    }

}
